timer: Ensure that CPU field of a timer is read safely when lock-free.
authorKeir Fraser <keir@xen.org>
Sat, 8 Jan 2011 10:09:44 +0000 (10:09 +0000)
committerKeir Fraser <keir@xen.org>
Sat, 8 Jan 2011 10:09:44 +0000 (10:09 +0000)
commitd8ec7a2381c2b26ea518610fa95c507c6872bdfa
tree1c520feb146f6c0ff6ff80d82d3e4a245f0b0927
parent44260b1a73a53f015530798438c20301f0858173
timer: Ensure that CPU field of a timer is read safely when lock-free.

Firstly, all updates must use atomic_write16(), and lock-free reads
must use atomic_read16(). Secondly, we ensure ->cpu is the only field
accessed without a lock. This requires us to place a special sentinel
value in that field when a timer is killed, to avoid needing to read
->status outside a locked critical section.

Signed-off-by: Keir Fraser <keir@xen.org>
xen/common/timer.c
xen/include/xen/timer.h